package cz.muni.fi.pa165.bookingmanager.bookingmanager;

import cz.muni.fi.pa165.bookingmanager.entities.Customer;
import cz.muni.fi.pa165.bookingmanager.dao.CustomerManager;
import cz.muni.fi.pa165.bookingmanager.dao.impl.CustomerManagerImpl;
import cz.muni.fi.pa165.bookingmanager.exceptions.IllegalOrphanException;
import cz.muni.fi.pa165.bookingmanager.exceptions.NonexistentEntityException;
import cz.muni.fi.pa165.bookingmanager.exceptions.PreexistingEntityException;
import cz.muni.fi.pa165.bookingmanager.entities.Hotel;
import cz.muni.fi.pa165.bookingmanager.dao.HotelManager;
import cz.muni.fi.pa165.bookingmanager.dao.impl.HotelManagerImpl;
import cz.muni.fi.pa165.bookingmanager.entities.Room;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args ) throws IllegalOrphanException, NonexistentEntityException, PreexistingEntityException
    {
        EntityManagerFactory enFactory = Persistence.createEntityManagerFactory("BookingManagerPU");
       // EntityManager manager = enFactory.createEntityManager();
        Customer c = new Customer();
        c.setFirstName("sda");
        c.setSurName("sdsda");
        c.setNumberOfIdCard("sdasdad");
        CustomerManager manager2 = new CustomerManagerImpl();
        manager2.createCustomer(c);
        
        manager2.deleteCustomer(c);
        
        Hotel h = new Hotel();
        h.setName("sdasd");
        h.setAdress("sdassdasdd"); 
        h.setDescription("sdasd");
        h.setCity("sdasdsadasda");
        List<Room> l = new ArrayList<Room>();
        h.setRooms(l);
        HotelManager manager = new HotelManagerImpl();
        manager.createHotel(h);
        
        manager.deleteHotel(h);
        
        System.out.println( "Hello World!" );
    }
}
